<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<html>
<head>
<title>schedule</title>

<%@ include file="/common/header/meta.jsp"%>
<%@ include file="/common/header/script.jsp"%>

<script src="/easy/script/plugins/dhtmlxScheduler_v4.1.0/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="/easy/script/plugins/dhtmlxScheduler_v4.1.0/codebase/dhtmlxscheduler.css" type="text/css" media="screen" title="no title">

<script src="/easy/script/plugins/dhtmlxScheduler_v4.1.0/codebase/locale/locale_cn.js" type="text/javascript" charset="utf-8"></script>
<script src="/easy/script/plugins/dhtmlxScheduler_v4.1.0/codebase/ext/dhtmlxscheduler_year_view.js" type="text/javascript" charset="utf-8"></script>
<script src="/easy/script/plugins/dhtmlxScheduler_v4.1.0/codebase/ext/dhtmlxscheduler_multisource.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" charset="utf-8">
	$(function() {
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.config.limit_time_select = true;
		scheduler.init('scheduler_here',new Date("2009-06-30"),"week");
		
		
		//点击保存按钮前触发
		scheduler.attachEvent("onEventSave", function(event_id,event_object) {
			if (!event_object.text) {
				alert("请输入你的日程信息在保存！"); return false;
			}
			return true;
		}) ;
		
		//添加事件，点击保存按钮后触发
		scheduler.attachEvent("onEventAdded", function(event_id,event_object) {
			var sdatestr=new Date(event_object.start_date).format("yyyy-MM-dd HH:mm:ss");  
            var edatestr=new Date(event_object.end_date).format("yyyy-MM-dd HH:mm:ss");  
			console.info(event_object) ;
			console.info(event_id+"======onEventAdded========="+event_object + sdatestr + "==" + edatestr) ;
		}) ;
		
		//编辑事件，点击保存后触发
		scheduler.attachEvent("onEventChanged", function(event_id,event_object) {
			var sdatestr=new Date(event_object.start_date).format("yyyy-MM-dd HH:mm:ss");  
            var edatestr=new Date(event_object.end_date).format("yyyy-MM-dd HH:mm:ss");  
			console.info(event_id+"======onEventChanged========="+event_object + sdatestr + "==" + edatestr) ;
		}) ;
		
		
		//点击删除按钮后触发
		scheduler.attachEvent("onBeforeEventDelete", function(event_id,event_object) {
			var sdatestr=new Date(event_object.start_date).format("yyyy-MM-dd HH:mm:ss");  
            var edatestr=new Date(event_object.end_date).format("yyyy-MM-dd HH:mm:ss");  
			console.info(event_id+"======onBeforeEventDelete========="+event_object + sdatestr + "==" + edatestr) ;
		}) ;
		
		
		//视图切换触发
		scheduler.attachEvent("onViewChange", function(new_mode, new_date) {
			console.info(new_mode) ;
			console.info(new Date(new_date).format("yyyy-MM-dd")) ;
			scheduler.clearAll();
			scheduler.parse([
			                 { start_date: "2009-06-30 09:00", end_date: "2009-07-01 12:00", text:"Task A-12458", section_id:1},
			                 { start_date: "2009-06-30 10:00", end_date: "2009-06-30 21:00", text:"Task A-89411", section_id:1},
			                 { start_date: "2009-06-30 10:00", end_date: "2009-07-01 14:00", text:"Task A-64168", section_id:1},
			                 { start_date: "2009-06-30 16:00", end_date: "2009-07-02 17:00", text:"Task A-46598", section_id:1},

			                 { start_date: "2009-06-30 12:00", end_date: "2009-07-02 20:00", text:"Task B-48865", section_id:2},
			                 { start_date: "2009-06-30 14:00", end_date: "2009-06-30 18:00", text:"Task B-44864", section_id:2},
			                 { start_date: "2009-06-30 16:30", end_date: "2009-07-01 18:00", text:"Task B-46558", section_id:2},
			                 { start_date: "2009-06-30 18:30", end_date: "2009-07-01 00:00", text:"Task B-45564", section_id:2},

			                 { start_date: "2009-06-30 08:00", end_date: "2009-07-01 12:00", text:"Task C-32421", section_id:3},
			                 { start_date: "2009-07-01 14:30", end_date: "2009-07-02 16:45", text:"Task C-14244", section_id:3},

			                 { start_date: "2009-07-01 09:20", end_date: "2009-07-01 18:20", text:"Task D-52688", section_id:4},
			                 { start_date: "2009-06-30 11:40", end_date: "2009-06-30 21:30", text:"Task D-46588", section_id:4},
			                 { start_date: "2009-07-01 12:00", end_date: "2009-07-02 18:00", text:"Task D-12458", section_id:4}
			             ],"json");
		}) ;
		
		
		
		
	});
</script>

</head>

<body>
	<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
		<div class="dhx_cal_navline">
			<div class="dhx_cal_prev_button">&nbsp;</div>
			<div class="dhx_cal_next_button">&nbsp;</div>
			<div class="dhx_cal_today_button"></div>
			<div class="dhx_cal_date"></div>
			<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
			<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
			<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
			<div class="dhx_cal_tab" name="year_tab" style="right:140px;"></div>
		</div>
		<div class="dhx_cal_header">
		</div>
		<div class="dhx_cal_data">
		</div>
	</div>
</body>

</html>